package com.neusoft.eenie.signdemo.http;

import com.neusoft.eenie.signdemo.bean.UserInfo;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;

/**
 * Created by Eenie on 2016/3/19.
 */
public class HttpUtiles {

    public static final String URL_SIGN_IN = "http://weixin.zjdzp.com/school/index.php/wap/privilege/signin";
    public static final String URL_LOAD_SESSION = "http://weixin.zjdzp.com/school/index.php/wap/privilege/login/o2pNgt_1fF3DutLh9to7KNzRod2g";
    public static final String URL_INDEX = "http://weixin.zjdzp.com/school/index.php/wap/main/index";
    public static final String URL_COMMIT = "http://weixin.zjdzp.com/school/index.php/wap/wdm/checking_update";
    public static final String URL_COMMIT_ADD = "http://weixin.zjdzp.com/school/index.php/wap/wdm/checking_add";
    public static final String URL_LOAD_CHECK = "http://weixin.zjdzp.com/school/index.php/wap/wdm/check";
    public static final String URL_LOAD_HISTORY = "http://weixin.zjdzp.com/school/index.php/wap/wdm/check_history";




    public static void signIn(final UserInfo userInfo, final Callback.CommonCallback callback) {


        RequestParams params = new RequestParams(URL_SIGN_IN);
        params.addBodyParameter("username", userInfo.getName());
        params.addBodyParameter("password", userInfo.getPwd());
        post(params, callback);


    }


    public static void get(RequestParams params, Callback.CommonCallback callback) {
        x.http().get(params, callback);
    }
    public static void get(String url, Callback.CommonCallback callback) {
        x.http().get(new RequestParams(url), callback);
    }

    public static void post(RequestParams params, Callback.CommonCallback callback) {
        x.http().post(params, callback);
    }



    public static void loadSession( Callback.CommonCallback callback) {
        RequestParams params = new RequestParams(URL_LOAD_SESSION);
        get(params, callback);

    }






}
